import os
import numpy as np
import cv2



def resize_image():
    image = cv2.imread('../data/anime_sample.jpg')
    image = cv2.resize(image, (256, 512))
    cv2.imwrite('../data/sample.jpg', image)


def load_text(text_path):
    data = []
    with open(text_path, 'r') as f:
        for line in f.readlines():
            v = float(line.strip())
            data.append(v)
    data = np.array(data)
    data = data.reshape((3, 224, 224))
    data = data.transpose((1, 2, 0))
    data = data[:, :, ::-1]
    # data = data.reshape((224, 224, 3))
    data = data * 0.5 + 0.5
    data = (data * 255).astype(np.uint8)
    cv2.imshow('data', data)
    cv2.waitKey(0)


if __name__ == '__main__':
    load_text('../data/sample.txt')
    # resize_image()

